package day05.concurrent02;

import java.util.concurrent.Semaphore;

public class Demo05 {
    public static void main(String[] args) throws InterruptedException {
        Semaphore semaphore = new Semaphore(3);
        System.out.println(semaphore);
        semaphore.acquire();
        semaphore.acquire();
        semaphore.acquire();
        System.out.println(semaphore);
        semaphore.release();
        semaphore.release();
        semaphore.release();
        System.out.println(semaphore);
        semaphore.release();
        semaphore.release();
        semaphore.release();
        System.out.println(semaphore);
    }
}
